package com.sikaryofficial.backend.controller.pointrule;

import com.sikaryofficial.backend.domain.dto.resp.points.PointsRuleDTO;
import com.sikaryofficial.backend.domain.dto.resp.points.PointsRuleTaskDTO;
import com.sikaryofficial.backend.manager.PointsRuleManager;
import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.common.core.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 积分获取-其他触发点
 *
 * @author qinjinyuan
 * @date 2024-07-10
 */
@RestController
@RequestMapping("/pointsRule/frontend")
@Api(tags = "V3.5-积分规则H5")
public class PointsRuleFrontendController extends BaseController {
    @Autowired
    private PointsRuleManager pointsRuleManager;

    /**
     * 首页浏览时长积分获取
     */
    @GetMapping("/browseDurationHome")
    @ApiOperation("首页浏览时长积分获取")
    public R<Boolean> browseDurationHome() {
        return R.ok(pointsRuleManager.browseDurationHome());
    }

    /**
     * 缓存列表查询
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    public R<List<PointsRuleDTO>> listFromCache() {
        return R.ok(pointsRuleManager.listFromCache());
    }

    /**
     * 查询积分任务列表
     * @return
     */
    @GetMapping("/task/list")
    @ApiOperation("积分任务")
    public R<List<PointsRuleTaskDTO>> listRuleTask() { return R.ok(pointsRuleManager.listRuleTask()); }
}
